<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1"><title id="di20941">DROP TABLE</title><body><p id="sql_command_desc">Removes a table.</p><section id="section2"><title>Synopsis</title><codeblock id="sql_command_synopsis">DROP TABLE [IF EXISTS] <varname>name</varname> [, ...] [CASCADE | RESTRICT]</codeblock></section><section id="section3"><title>Description</title><p><codeph>DROP TABLE</codeph> removes tables from the database. Only the table owner, the schema
        owner, and superuser can drop a table. To empty a table of rows without removing the table
        definition, use <codeph>DELETE</codeph> or <codeph>TRUNCATE</codeph>. </p><p><codeph>DROP TABLE</codeph> always removes any indexes, rules, triggers,
and constraints that exist for the target table. However, to drop a table
that is referenced by a view, <codeph>CASCADE</codeph> must be specified.
<codeph>CASCADE</codeph> will remove a dependent view entirely.</p></section><section id="section4"><title>Parameters</title><parml><plentry><pt>IF EXISTS</pt><pd>Do not throw an error if the table does not exist. A notice is issued
in this case.</pd></plentry><plentry><pt><varname>name</varname></pt><pd>The name (optionally schema-qualified) of the table to remove.</pd></plentry><plentry><pt>CASCADE</pt><pd>Automatically drop objects that depend on the table (such as views).</pd></plentry><plentry><pt>RESTRICT</pt><pd>Refuse to drop the table if any objects depend on it. This is the
default. </pd></plentry></parml></section><section id="section5"><title>Examples</title><p>Remove the table <codeph>mytable</codeph>: </p><codeblock>DROP TABLE mytable;</codeblock></section><section id="section6"><title>Compatibility</title><p><codeph>DROP TABLE</codeph> is fully conforming with the SQL standard,
except that the standard only allows one table to be dropped per command.
Also, the <codeph>IF EXISTS</codeph> option is a Greenplum Database extension.</p></section><section id="section7"><title>See Also</title><p><codeph><xref href="CREATE_TABLE.xml#topic1" type="topic" format="dita"/></codeph>, <codeph><xref
            href="ALTER_TABLE.xml#topic1" type="topic" format="dita"/></codeph>, <codeph><xref
            href="./TRUNCATE.xml#topic1" type="topic" format="dita"/></codeph></p></section></body></topic>
